package DesignPattern.Builder.FactoryPattern.StaticFactory;

public class StaticCoffeeFactory {

    public static Coffee CreateCoffee(String type) {
        Coffee coffee = null;
        if (type.equals("American")) {
            coffee = new AmericanCoffee();
        } else if (type.equals("Latte")) {
            coffee = new LatteCoffee();
        } else {
            throw new RuntimeException("你所点的咖啡没有");
        }
        return coffee;
    }
}
